package com.simpleframe.views.components;

import java.io.Writer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.simpleframe.util.Utils;

public class Message extends Component {
	
	protected Collection<String> errors;
	protected Collection<String> messages;
		
	@Override
	public boolean end(Writer writer, String tagBody) {
		evaluateParameters();
		mergeTemplate(writer,getTemplate());
		return false;
	}
	
	protected void evaluateParameters(){
		if(errors!=null){
			addParameter("errors", errors);
		}

		if(messages!=null){
			addParameter("messages", messages);
		}
		
	}
	
	public void setErrors(Collection<String> errors) {
		this.errors = errors;
	}
	
	public void setMessages(Collection<String> messages) {
		this.messages = messages;
	}

}
